#!/bin/sh

# Prepare bots by creating ./bots directory
# Specify $COCKPIT_BOTS_REF to checkout non-master branch

GITHUB_REPO='bots'
SUBDIR='bots'

V="${V-0}" # default to friendly messages

set -eu
cd "$(realpath -m "$0"/../..)"
. tools/git-utils.sh

if [ ! -d bots ]; then
    [ -n "${quiet}" ] || set -x
    # it's small, so keep everything cached
    fetch_to_cache ${COCKPIT_BOTS_REF+"${COCKPIT_BOTS_REF}"}
    clone_from_cache "${COCKPIT_BOTS_REF-master}"
else
    echo "bots/ already exists, skipping"
fi
